package com.beans;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class UserController3 {
    private UserService userService;

    @Autowired//如果当前类只存在一个构造方法，那么@Autowired注解可以省略
    public UserController3(UserService userService){
        this.userService = userService;
    }

    public void sayHi(){
        userService.sayHi();
    }
}
